package com.leil.project.presentation

import com.leil.project.data.RemindersRepository
import com.leil.project.domain.Reminder

class RemindersViewModel : BaseViewModel() {
    private val repository = RemindersRepository()

    private val reminders: List<Reminder>
        get() = repository.reminders

    var onRemindersUpdated: ((List<Reminder>) -> Unit)? = null
        set(value) {
            field = value
            onRemindersUpdated?.invoke(reminders)
        }

    fun createReminder(description: String, groupName: String, deadline: String) {
        repository.createReminder(description, groupName, deadline)
        onRemindersUpdated?.invoke(reminders)
    }


    fun markReminder(id: String, isComplete: Boolean) {
        repository.markReminder(id, isComplete)
        onRemindersUpdated?.invoke(reminders)
    }




}